package com.cloud.poetry.base.feign;

import com.cloud.poetry.base.entity.res.SaveFileOutParam;
import com.cloud.poetry.base.feign.fallback.FileFeignClientFallBack;
import com.cloud.poetry.core.constant.PoetryConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author mengxj
 */
@FeignClient(value = "cloud-file-server", fallbackFactory = FileFeignClientFallBack.class)
public interface FileFeignClient {

    @PostMapping(value = "mini/save", headers = {PoetryConstant.FEIGN_HEADER}, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    SaveFileOutParam saveFile(@RequestPart("file") MultipartFile file);
}
